import { getChannels } from '@/store/actions/channel.js'
import {useDispatch,useSelector} from 'react-redux'
import {useEffect} from 'react'  

// 获取频道数据
export const useChannels=()=>{
    const dispatch=useDispatch()
    const channelList=useSelector(state=>state.channel)
    useEffect(()=>{
        dispatch(getChannels())
    },[dispatch])
    return channelList
}